// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** addGenerator POST /api/generator/add */
export async function addGeneratorUsingPost(
  body: API.GeneratorAddRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseLong_>('/api/generator/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** cacheGenerator POST /api/generator/cache */
export async function cacheGeneratorUsingPost(
  body: API.GeneratorCacheRequest,
  options?: { [key: string]: any },
) {
  return request<any>('/api/generator/cache', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** deleteGenerator POST /api/generator/delete */
export async function deleteGeneratorUsingPost(
  body: API.DeleteRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/api/generator/delete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** downloadGeneratorById GET /api/generator/download */
export async function downloadGeneratorByIdUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.downloadGeneratorByIdUsingGETParams,
  options?: { [key: string]: any },
) {
  return request<any>('/api/generator/download', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** editGenerator POST /api/generator/edit */
export async function editGeneratorUsingPost(
  body: API.GeneratorEditRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/api/generator/edit', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** getGeneratorVOById GET /api/generator/get/vo */
export async function getGeneratorVoByIdUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getGeneratorVOByIdUsingGETParams,
  options?: { [key: string]: any },
) {
  return request<API.GoodsResult>('/api/goods/details/'+params.id, {
    method: 'GET',
    ...(options || {}),
  });
}

/** getCategoryUsingGet GET /api/category/getCategory */
export async function getCategoryUsingGet(
  options?: { [key: string]: any },
) {
  return request<API.CategoryVO[]>('/api/category/getCategory', {
    method: 'GET',
    ...(options || {}),
  });
}

/** listGeneratorByPage POST /api/generator/list/page */
export async function listGeneratorByPageUsingPost(
  body: API.GeneratorQueryRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageGenerator_>('/api/generator/list/page', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** listGeneratorVOByPage POST /api/generator/list/page/vo */
export async function listGeneratorVoByPageUsingPost(
  body: API.GeneratorQueryRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageGeneratorVO_>('/api/generator/list/page/vo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** searchByName POST /api/goods/search */
export async function searchByName(
  body: string,
  options?: { [key: string]: any },
) {
  return request<API.GoodsResult[]>('/api/goods/search', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data:{
      name:body
    },
    ...(options || {}),
  });
}

/** makeGenerator POST /api/generator/make */
export async function makeGeneratorUsingPost(
  body: API.GeneratorMakeRequest,
  options?: { [key: string]: any },
) {
  return request<any>('/api/generator/make', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** listMyGeneratorVOByPage POST /api/generator/my/list/page/vo */
export async function listMyGeneratorVoByPageUsingPost(
  body: API.GeneratorQueryRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageGeneratorVO_>('/api/generator/my/list/page/vo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** updateGenerator POST /api/generator/update */
export async function updateGeneratorUsingPost(
  body: API.GeneratorUpdateRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/api/generator/update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** useGenerator POST /api/generator/use */
export async function useGeneratorUsingPost(
  body: API.GeneratorUseRequest,
  options?: { [key: string]: any },
) {
  return request<any>('/api/generator/use', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/**
 * 获取商品信息 GET /api/goods/getGoods/{classify}
 */
export async function getGoods(id:number){
  return request<API.GoodsResult[]>('/api/goods/getGoods', {
    method: 'GET',
    params:{
      id:id,
    }
  });
}

/**
 * 获取推荐商品 GET /api/goods/recommend
 */
export async function getRecommend(id:number){
  return request<API.GoodsResult[]>('/api/goods/recommend', {
    method: 'GET',
    params:{
      id:id
    }
  });
}

/**
 * 获取推荐商品 GET /api/goods/newGoods
 */
export async function getNewGoods(id:number){
  return request<API.GoodsResult[]>('/api/goods/newGoods', {
    method: 'GET',
    params:{
      id:id
    }
  });
}

/**
 * 获取评论 GET /api/comment/getComment/{goodsId}
 */
export async function getComment(goodsId:number){
  return request<API.CommentResult[]>('/api/comment/getComment', {
    method: 'GET',
    params:{
      goodsId:goodsId
    }
  });
}
/**
 * 新增评论 POST /api/comment/addComment
 */
export async function createComment(userId:number,goodsId:number,description:string,options?: { [key: string]: any }){
  return request<boolean>('/api/comment/addComment',{
    method:'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data:{
      userId:userId,
      goodsId:goodsId,
      commentsDescription:description
    },
    ...(options || {}),
  })
}

/**
 * 新增商品 POST /api/goods/add
 */
export async function doAdd(data:API.GoodsAddQuery,options?: { [key: string]: any }){
  return request<boolean>('/api/goods/add',{
    method:'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data:data,
    ...(options || {}),
  })
}
